﻿@model IEnumerable<MiniBottles.Models.DictCategory>

@{
    ViewBag.Title = "Lista kategorii";
}
@section leftmenu
 {
    @Html.Action("Menu", "Administration")
}
<p>
    @Html.ActionLink("Dodaj kategorie", "Create", null, new { @class = "btn btn-inverse" })
</p>
<div class="da-panel collapsible">
    <div class="da-panel-header">
        <span class="da-panel-title">
            <img src="images/icons/black/16/list.png" alt="" />
            @ViewBag.Title
        </span>

    </div>
    <div class="da-panel-content">
        <table id="da-ex-datatable-numberpaging" class="da-table">
            <thead>
                <tr>
                    <th>
                        @Html.DisplayNameFor(model => model.Name)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.DictCollection)
                    </th>
                    <th>Miniaturka
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.CreateDate)
                    </th>

                    <th>
                        @Html.DisplayNameFor(model => model.IsActive)
                    </th>
                    <th>Akcje
                    </th>

                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.Name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.DictCollection.Name)
                        </td>
                        <td>
                            @if (!string.IsNullOrEmpty(item.FileName))
                            {
                                <a href="~/Upload/big/@item.FileName" rel="lightbox[roadtrip]" title="@item.Name">
                                    <img  src="~/Upload/mini/@item.FileName" />
                                </a>
                            }
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.CreateDate)
                        </td>

                        <td>
                            @Html.DisplayFor(modelItem => item.IsActive)
                        </td>
                        <td>

                            <a title="Edytuj" href="@Url.Action("Edit", new { id = item.Id })"><i class="icon-pencil"></i></a>
                            <a title="Dodaj miniaturke do kategorii" href="@Url.Action("Create","Bottle", new { categoryId = item.Id })"><i class="icon-plus"></i></a>
                            @*   <a title="Szczegóły" href="@Url.Action("Details",new { id=item.Id })"><i class="icon-info-sign"></i></a>*@
                            @if(item.Bottles.Where(x=> !x.IsDeleted).Count() < 1)
                            {
                            <a title="Usuń" href="@Url.Action("Delete", new { id = item.Id })"><i class="icon-remove-sign"></i></a>
                            }

                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
